package com.turtle3d;

import java.awt.Dimension;
import java.io.File;
import java.net.URL;
import java.net.URLDecoder;

import javax.swing.JFrame;
import javax.swing.WindowConstants;

import com.turtle3d.gui.PrintCanvas3D;
import com.turtle3d.gui.toolbox.Toolbox;

/**
 * Application launcher.
 * 
 * @author Marek Paterczyk <marek.paterczyk@gmail.com>
 * 
 */
public class Turtle3DLauncher
{
	
	public static final int size = 800;

	public static void main(String[] args)
	{
		JFrame toolboxJFrame = new JFrame();
		toolboxJFrame.setTitle("Toolbox");
		Toolbox toolbox = new Toolbox();
		toolboxJFrame.getContentPane().add(toolbox);
		toolboxJFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
		toolboxJFrame.pack();
		
		
		PrintCanvas3D printCanvas3D = new PrintCanvas3D(args);
		printCanvas3D.setSize(new Dimension(size,size));
		printCanvas3D.setTitle("Turtle3D Canvas");
		printCanvas3D.setVisible(true);
		
		toolboxJFrame.setLocation(size+20, 0);
		toolboxJFrame.setSize(200, size);
		toolboxJFrame.setVisible(true);
		
		FractalGenerator fractalGenerator = new FractalGenerator();
		toolbox.setGenerateFractalListener(fractalGenerator);
		fractalGenerator.setPrintCanvas3D(printCanvas3D);
		
		ResourceManager.getGrammars();
						
	}

}
